package com.m.job.logs.controller;


import com.client.job.utils.DataResult;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.m.job.logs.model.dto.MJobInstanceHistoryDto;
import com.m.job.logs.service.MJobInstanceHistoryService;
import com.m.utils.PageSearchDomain;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;



import javax.annotation.Resource;

/**
 * 实例操作日志
 *
 * @author mnengxiangzhong
 * @version 1.0
 * @date 2021/9/17/017
 */
@RestController
@RequestMapping("/mjobInstance/history")
@Api(tags = "实例操作日志")
public class MJobInstanceHistoryController {

	@Resource
	private MJobInstanceHistoryService mJobInstanceHistoryService;

	@PostMapping("/list")
	@ApiOperation("查询")
	public DataResult list(@RequestBody PageSearchDomain<MJobInstanceHistoryDto> page) {
		if (page.getPageNum() != null) {
			PageHelper.startPage(page.getPageNum(), page.getPageSize());
		}		
		PageInfo<MJobInstanceHistoryDto> resPage = new PageInfo<MJobInstanceHistoryDto>(
				mJobInstanceHistoryService.getList(page.getObj()));
		return DataResult.buildSuccess(resPage);
	}
}
